package com.innovapost.demo.greetings;

import java.io.PrintStream;

public class HelloWorld {

        private final PrintStream out;
        private final LanguageBundle bundle;

        public HelloWorld(PrintStream out, LanguageBundle bundle) {
                this.out = out;
                this.bundle = bundle;
        }

        /**
         * @param args
         */
        public static void main(String[] args) {
                System.out.println("--------------------------");
                HelloWorld helloWorld = new HelloWorld(System.out, LanguageBundle.EN);
                helloWorld.saySomething();
                System.out.println("--------------------------");
        }

        private void saySomething() {
                        sayHello();
                        askAQuestion();
                        sayGoodbye();
        }

        private void sayHello() {
                printMessage(out, bundle.getGreeting());
        }

        private void askAQuestion() {
                printMessage(out, bundle.getQuestion());
        }
        
        private void sayGoodbye() {
                printMessage(out, bundle.getGoodbye());
        }
        
        private void printMessage(PrintStream printStream, String message) {
                printStream.println(message);
        }

}
